package com.lanou.elh.sysmanage.authority_management.service.impl;

import com.lanou.elh.sysmanage.authority_management.entity.Permission;
import com.lanou.elh.sysmanage.authority_management.mapper.PermissionMapper;
import com.lanou.elh.sysmanage.authority_management.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PermissionServiceImpl implements PermissionService {

    @Autowired
    private PermissionMapper permissionMapper;
    @Override
    public List<Permission> selectAllPermission() {
      return  permissionMapper.selectAllPermission();
    }

    @Override
    public void deletePermissonById(Integer id) {
       permissionMapper.deletePermissonById(id);
    }

    @Override
    public void deleteAllPermissonById(Integer[] id) {
        for (int i = 0; i < id.length; i++) {
            permissionMapper.deletePermissonById(id[i]);
        }

    }

    @Override
    public void updatePermissonById(Permission permission) {
        permissionMapper.updatePermissonById(permission);
    }

    @Override
    public void addPermisson(Permission permission) {
        permissionMapper.addPermisson(permission);
    }
}
